// 主界面
;define(function(require, exports, module) {
  'use strict';
  var util = require("util");
  var base = require("base");
  var validate = require("validate");
  var dialog = require("dialog");
  var topMenu = require("../topMenu/topMenu");
  var databind = require("databind");

  var init = function(){
    topMenu.init();
    $(".table-section").removeClass("none");
    $(".footer").removeClass("none");
    initEvent();
  };



  var initEvent = function(){
    $("#page-change-password").on("click",".button-back",function(){
      window.history.go(-1);
    });

    $("#page-change-password").on("click",".button-edit",function(){
      var   form = base.parseForm($(".changePassword"));
      if(form.newPassword != form.repeatNewPassword){
        base.alert(3,"两次新密码不一致");
        return;
      }
      databind.submitDom($(".changePassword"),function(data){
        var newSessionId = data.datas[0].sessionUuid;
        base.saveData("sid",newSessionId);
        base.sid=newSessionId;
        util.alert("修改成功");
      });
    });



  }


  return {
    init:init
  };
});
